Convert the format to the current locale before passing it to strtime().
authorEmmanuele Bassi <ebassi@gnome.org>
Wed, 10 Oct 2007 08:09:13 +0000 (08:09 +0000)
committerEmmanuele Bassi <ebassi@src.gnome.org>
Wed, 10 Oct 2007 08:09:13 +0000 (08:09 +0000)
2007-10-10  Emmanuele Bassi  <ebassi@gnome.org>

* gtk/gtkfilechooserdefault.c (list_mtime_data_func): Convert
the format to the current locale before passing it to
strtime(). Fixes corrupt dates with non-UTF8 encodings on
OpenSolaris. (#465380, Takao Fujiwara)

svn path=/trunk/; revision=18903

ChangeLog
gtk/gtkfilechooserdefault.c

index 40777eed0052b7e7fc3b62023006786327721a7d..af938db8af5811c9f25074ffd6bb7c2349c5eebf 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2007-10-10  Emmanuele Bassi  <ebassi@gnome.org>
+
+       * gtk/gtkfilechooserdefault.c (list_mtime_data_func): Convert
+       the format to the current locale before passing it to
+       strtime(). Fixes corrupt dates with non-UTF8 encodings on
+       OpenSolaris. (#465380, Takao Fujiwara)
+
 2007-10-10  Emmanuele Bassi  <ebassi@gnome.org>
 
        * gtk/gtkfilechooserdefault.c (list_mtime_data_func): Fix the
index 47d0b81caa9683507aa228070ea14d8dfb5fa720..33eb2648fbbd3dbbca58b27c8bdaf7fa3486ed3e 100644 (file)
@@ -11101,6 +11101,7 @@ list_mtime_data_func (GtkTreeViewColumn *tree_column,
       struct tm tm_mtime;
       time_t time_now;
       const gchar *format;
+      gchar *locale_format = NULL;
       gchar buf[256];
 
 #ifdef HAVE_LOCALTIME_R
@@ -11143,10 +11144,14 @@ list_mtime_data_func (GtkTreeViewColumn *tree_column,
            format = "%x"; /* Any other date */
        }
 
-      if (strftime (buf, sizeof (buf), format, &tm_mtime) != 0)
+      locale_format = g_locale_from_utf8 (format, -1, NULL, NULL, NULL);
+
+      if (strftime (buf, sizeof (buf), locale_format, &tm_mtime) != 0)
         date_str = g_locale_to_utf8 (buf, -1, NULL, NULL, NULL);
       else
        date_str = g_strdup (_("Unknown"));
+
+      g_free (locale_format);
     }
 
   g_object_set (cell,